﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.ServiceModel.Description;
using Mads.CoreDomain;
using Mads.CoreDomain.Enumerations;

namespace Mads.WcfService
{
  [ServiceContract(Namespace = "http://ProgrammingHelp.Service/")]
  public interface ITrainManager
  {
    [OperationContract]
    bool BuyTicket(int userId, FreeTicket ticket, Station departure, 
      Station arrival, string ownerName, string ownerDocNumber);

    [OperationContract]
    IEnumerable<FreeTicket> GetTickets(
      int sessionId, DateTime departureTime,
      Station departureStation, Station arrivalStation);

    [OperationContract]
    TicketToReturn GetTicketByNumber(int userID, string logicalID);

    [OperationContract]
    bool ReturnTicket(int userId, string ticketId);

    [OperationContract]
    bool BuyPendingTicket(int userId, Ticket ticket);

    [OperationContract]
    IEnumerable<Station> GetStations(int sessionId);

    [OperationContract]
    IEnumerable<CarType> GetCarTypes(int sessionId);
   
    [OperationContract]
    int InitUser();

    [OperationContract]
    bool Login(int sessionId, string name, string password, out bool isBot);

    [OperationContract]
    void Logout(int sessionId);

    [OperationContract]
    void Shutdown(int sessionId);

    [OperationContract]
    bool Register(int sessionId, string name, string password, string email, int role);

    [OperationContract]
    bool AddRoute(int sessionId, uint routeNumber, SpeedType speedType,
      Regularity regularity, Dictionary<CarType, int> cars,
      Dictionary<TimeSpan, Station> departure, Dictionary<Station, TimeSpan> waitMinutes,
      float priceCoefficient);

    [OperationContract]
    bool AddPrice(int sessionId, Dictionary<Dictionary<Station, Station>, float> stationPrice);

    [OperationContract]
    bool ChangeSeasonPrice(int sessionId, Dictionary<TimeSpan, float> seasonCoefficient);

    [OperationContract]
    string GetInfoToCheckBot(int userId);

    [OperationContract]
    bool CheckBot(int userId, int sum);

    [OperationContract]
    bool isCashier(int sessionId);

    [OperationContract]
    IEnumerable<User> GetUsers();

    [OperationContract]
    bool LoginForAdministrator(int sessionId, string name, string password, out bool isBot);

    [OperationContract]
    bool DeleteUser(string name, string password);

    [OperationContract]
    bool EditUser(string name, string password,int role);

    [OperationContract]
    bool GetCars(int sessionId);

    [OperationContract]
    bool AddRouteFromAdministrator(int sessionId, uint routeNumber, int speedType,
      int regularity, int CoupeCarsNumber, int SecondClassCarsNumber,
      Dictionary<TimeSpan, Station> departure, Dictionary<Station, TimeSpan> waitMinutes,
      float priceCoefficient);
  }
}
